package com.insane.web.service;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.insane.web.dao.BaseDao;

public class BaseService<T, PK extends Serializable> {

	@Autowired
	private BaseDao<T, PK> baseDao;

	public PK save(T entity) {
		return baseDao.save(entity);
	}

	public void saveOrUpdate(T entity) {
		baseDao.saveOrUpdate(entity);
	}

	public void update(T entity) {
		baseDao.update(entity);
	}

	public void delete(PK id) {
		baseDao.delete(id);
	}

	public void deleteObject(T entity) {
		baseDao.deleteObject(entity);
	}

	public boolean exists(PK id) {
		return baseDao.exists(id);
	}

	public T load(PK id) {
		return baseDao.load(id);
	}

	public T get(PK id) {
		return baseDao.get(id);
	}

	public void deleteAll(Collection<?> entities) {
		baseDao.deleteAll(entities);
	}
	
	public void saveAll(Collection<?> entities) {
		baseDao.saveAll(entities);
	}

	public List<T> getAll() {
		return baseDao.getAll();
	}

	// public List<T> getByIds(String[] ids) {
	// return baseDao.getByIds(ids);
	// }

}
